<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript">
  Date.prototype.Format = function (fmt) { //author: meizz
    var o = {
      "M+": this.getMonth() + 1, //月份
      "d+": this.getDate(), //日
      "h+": this.getHours(), //小时
      "m+": this.getMinutes(), //分
      "s+": this.getSeconds(), //秒
      "q+": Math.floor((this.getMonth() + 3) / 3), //季度
      "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
      if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
  }

  function setIdNo(){
    getBirthday('idNo','birthdayDate')
  }
  setIdNo();
  function report() {
    for (var i = 0; i < 3; i++) {
      document.getElementsByName('correctType')[i].disabled = true;
      document.getElementsByName('correctType')[i].checked = false;
    }
  }
  function report1() {
    for (var i = 0; i < 3; i++) {
      document.getElementsByName('correctType')[i].disabled = false;
    }
  }
  function infectionA() {
    for (var i = 0; i < 42; i++) {
      document.getElementsByName('bInfection')[i].checked = false;
    }
    for (var i = 0; i < 10; i++) {
      document.getElementsByName('cInfection')[i].checked = false;
    }
  }
  function infectionB() {
    for (var i = 0; i < 1; i++) {
      document.getElementsByName('aInfection')[i].checked = false;
    }
    for (var i = 0; i < 10; i++) {
      document.getElementsByName('cInfection')[i].checked = false;
    }
  }
  function infectionC() {
    for (var i = 0; i < 42; i++) {
      document.getElementsByName('bInfection')[i].checked = false;
    }
    for (var i = 0; i < 1; i++) {
      document.getElementsByName('aInfection')[i].checked = false;
    }
  }
  function print(id,clinicId,patientId){
    printPdf('${ctx}/doctor/placeInfectionRecord/print?id='+id+'&clinicId='+clinicId, 'patientId='+patientId);
  }
  function checkage(){
    var myDate = new Date();
    var date=new Date($("#birthdayDate").val().replace(/-/g, "/"));
    var aaInfection=$("input[name='aInfection']:checked").val();
    var bbInfection=$("input[name='bInfection']:checked").val();
    var ccInfection=$("input[name='cInfection']:checked").val();
    if((myDate.getFullYear()-date.getFullYear())*1<12 &&$("#genearchName").val().length<=0){
      toastr.info('患儿年龄太小，请填写患儿家长姓名！');
    }
    else if(aaInfection>='1'| bbInfection>='1'| ccInfection>='1'){
      $("#submit").attr("type","submit");

    }else{
      toastr.info('请选择一种传染病！');
    }
  }
</script>
<div>
<form id="inputForm"   method="post" class="form-horizontal" onsubmit="return formSaveLoad('rigthDoctorCenterDiv','inputForm','${ctx}/doctor/placeInfectionRecord/save','${ctx}/doctor/placeInfectionRecord/index?clinicId=${clinicMaster.id}&patientId=${patMasterIndex.id}');">
  <input type="hidden" name="clinicId" value="${clinicMaster.id}" >
  <input type="hidden" name="patientId" value="${patMasterIndex.id}" >
  <input type="hidden" name="patMasterIndex.id" value="${patMasterIndex.id}" >
  <input type="hidden" name="id" value="${placeInfectionRecord.id}" >
  <p align="center"><label><font size="4">中华人民共和国传染病报告卡</font></label></p>
  卡片编号：${placeInfectionRecord.infectionNo}&nbsp;&nbsp;&nbsp;&nbsp;
  <input type="radio" onclick="report()" name="reportType" <c:if test="${'1'==placeInfectionRecord.reportType}">checked="checked"</c:if> data-parsley-required="true" value="1"/>初次报告
  <input type="radio" onclick="report1()"name="reportType" <c:if test="${'2'==placeInfectionRecord.reportType}">checked="checked"</c:if> data-parsley-required="true" value="2"/>订正报告
  <sys:checkbox typeText="1" lists="${fns:getDictList('CORRECT_TYPE_DICT')}"  name="correctType"></sys:checkbox>
  <div class="opertion_items">
    <div>基本信息</div>
  </div>
  <fieldset>
    <div class="form-group">
      <div class="col-lg-4">
        <label class="col-sm-5">患者姓名*：</label>
        <div class="col-sm-7">
          ${patMasterIndex.name}
          <input type="hidden" name="patMasterIndex.name" value="${patMasterIndex.name}" class="form-control">
        </div>
      </div>
      <div class="col-lg-4">
        <label class="col-sm-6">患儿家长姓名：</label>
        <div class="col-sm-6">
          <input type="text" name="genearchName" id="genearchName" value="${placeInfectionRecord.genearchName}" class="form-control">
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-4">
        <label class="col-sm-5">身份证号：</label>
        <div class="col-sm-7">
          <input type="text" name="patMasterIndex.idNo" onchange="setIdNo()" id="idNo" value="${patMasterIndex.idNo}" class="form-control">
        </div>
      </div>
      <div class="col-lg-6">
        <label class="col-sm-3">性别*：</label>
        <div class="col-sm-9">
          <c:forEach items="${fns:getDictList('SEX_DICT')}" var="o">
              <input type="radio" data-parsley-required="true" name="sex"<c:if test="${o.value==patMasterIndex.sex}">checked="checked"</c:if> value="${o.value}"/>${o.label}
          </c:forEach>
        </div>
      </div>
      <div class="col-lg-2">
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-4">
        <label class="col-sm-5">出生日期*：</label>
        <div class="col-sm-7">
          <input type="text" name="patMasterIndex.birthdayDate" id="birthdayDate" data-parsley-required="true"
                 value="<fmt:formatDate value="${patMasterIndex.birthdayDate}" pattern="yyyy-MM-dd" type="date" dateStyle="long" />" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate">
        </div>
      </div>
      <div class="col-lg-5">
        <p class="col-sm-9">如果真实年龄不详，实足年龄：</p>
        <div class="col-sm-3">
          <input type="text" name="realityAge" value="${placeInfectionRecord.realityAge}" class="form-control">
        </div>
      </div>
      <div class="col-lg-3">
        年龄单位：
          <c:forEach items="${fns:getDictList('AGE_UNIT_DICT')}" var="o">
            <input type="radio" name="ageUnit"<c:if test="${o.value==placeInfectionRecord.ageUnit}">checked="checked"</c:if> value="${o.value}"/>${o.label}
          </c:forEach>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-8">
        <label class="col-sm-5">工作单位或学校或托幼机构*：</label>
        <div class="col-sm-7">
          <input type="text" name="workUnit" data-parsley-required="true" value="${placeInfectionRecord.workUnit}" class="form-control">
        </div>
      </div>
      <div class="col-lg-4">
        <label class="col-sm-5">联系电话：</label>
        <div class="col-sm-7">
          <input type="text" data-parsley-mobilephone="ture" name="phone" value="${placeInfectionRecord.phone}" class="form-control">
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">病人属于*：</label>
        <div class="col-sm-10">
          <c:forEach items="${fns:getDictList('AREA_DICT')}" var="o">
            <input type="radio" data-parsley-required="true" name="patientArea"<c:if test="${o.value==placeInfectionRecord.patientArea}">checked="checked"</c:if> value="${o.value}"/>${o.label}
          </c:forEach>
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">现住地址*：</label>
        <div class="col-sm-10">
          <input type="text" name="patMasterIndex.address" data-parsley-required="true" value="${patMasterIndex.address}" class="form-control">
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">患者职业*：</label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <div class="col-sm-12">
          <table border="0" width="100%">
            <c:forEach varStatus="i" begin="1" end="3">
              <tr align="left">
                <c:forEach items="${fns:getDictList('INFECTION_IDENTITY_DICT')}" var="o" begin="${(i.index-1)*6}" end="${(i.index-1)*6+5}">
                  <td width="16.6%">
                    <input type="radio" data-parsley-required="true" name="infectionIdentity"<c:if test="${o.value==placeInfectionRecord.infectionIdentity}">checked="checked"</c:if> value="${o.value}"/>${o.label}
                  </td>
                </c:forEach>
              </tr>
            </c:forEach>
          </table>
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">病例分类*：</label>
        <div class="col-sm-10">
          （1）<c:forEach items="${fns:getDictList('CASE_TYPE_DICT')}" var="o">
            <input type="radio" data-parsley-required="true" name="caseType"<c:if test="${o.value==placeInfectionRecord.caseType}">checked="checked"</c:if> value="${o.value}"/>${o.label}
          </c:forEach>
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2"></label>
        <div class="col-sm-3">
          （2）<c:forEach items="${fns:getDictList('SPEED_TYPE_DICT')}" var="o">
            <input type="radio" data-parsley-required="true" name="speedType"<c:if test="${o.value==placeInfectionRecord.speedType}">checked="checked"</c:if> value="${o.value}"/>${o.label}
          </c:forEach>
        </div>
        <label class="col-sm-7">(乙肝类型、丙肝类型、血吸虫病填写）</label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">发病日期*：</label>
        <div class="col-sm-2">
          <input type="text" name="illnessDate"  data-parsley-required="true"
                 value="<fmt:formatDate value="${placeInfectionRecord.illnessDate}" pattern="yyyy-MM-dd" type="date" dateStyle="long" />" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate">
        </div>
        <label class="col-sm-8">（病原携带者填初检日期或就诊日期）</label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">诊断日期*：</label>
        <div class="col-sm-2">
          <input type="text" name="diagnoseDate"  data-parsley-required="true"
                 value="<fmt:formatDate value="${placeInfectionRecord.diagnoseDate}" pattern="yyyy-MM-dd" type="date" dateStyle="long" />" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate">
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">死亡日期：</label>
        <div class="col-sm-2">
          <input type="text" name="deathDate"
                 value="<fmt:formatDate value="${placeInfectionRecord.deathDate}" pattern="yyyy-MM-dd" type="date" dateStyle="long" />" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate">
        </div>
      </div>
    </div>
    <hr/>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">甲类传染病*：</label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <div class="col-sm-12">
          <c:forEach items="${fns:getDictList('A_INFECTION_DICT')}" var="o">
            <input type="radio" onclick="infectionA()"name="aInfection"<c:if test="${o.value==placeInfectionRecord.aInfection}">checked="checked"</c:if> value="${o.value}"/>${o.label}
          </c:forEach>
        </div>
      </div>
    </div>
    <hr/>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">乙类传染病*：</label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <div class="col-sm-12">
          <table border="0" width="100%">
            <c:forEach varStatus="i" begin="1" end="7">
              <tr align="left">
                <c:forEach items="${fns:getDictList('B_INFECTION_DICT')}" var="o" begin="${(i.index-1)*5}" end="${(i.index-1)*5+4}">
                  <td width="20%">
                    <input type="radio" onclick="infectionB()"name="bInfection"<c:if test="${o.value==placeInfectionRecord.bInfection}">checked="checked"</c:if> value="${o.value}"/>${o.label}
                  </td>
                </c:forEach>
              </tr>
            </c:forEach>
            <tr align="left">
              <c:forEach items="${fns:getDictList('B_INFECTION_DICT')}" var="o" begin="35" end="38">
                <td width="20%">
                  <input type="radio" onclick="infectionB()"name="bInfection"<c:if test="${o.value==placeInfectionRecord.bInfection}">checked="checked"</c:if> value="${o.value}"/>${o.label}
                </td>
              </c:forEach>
            </tr>
            <tr align="left">
              <c:forEach items="${fns:getDictList('B_INFECTION_DICT')}" var="o" begin="39" end="42">
                <td width="20%">
                  <input type="radio" onclick="infectionB()"name="bInfection"<c:if test="${o.value==placeInfectionRecord.bInfection}">checked="checked"</c:if> value="${o.value}"/>${o.label}
                </td>
              </c:forEach>
            </tr>
          </table>
        </div>
      </div>
    </div>
    <hr/>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-2">丙类传染病*：</label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <div class="col-sm-12">
          <table border="0" width="100%">
            <c:forEach varStatus="i" begin="1" end="3">
              <tr align="left">
                <c:forEach items="${fns:getDictList('C_INFECTION_DICT')}" var="o" begin="${(i.index-1)*4}" end="${(i.index-1)*4+3}">
                  <td width="25%">
                    <input type="radio" onclick="infectionC()"name="cInfection"<c:if test="${o.value==placeInfectionRecord.cInfection}">checked="checked"</c:if> value="${o.value}"/>${o.label}
                  </td>
                </c:forEach>
              </tr>
            </c:forEach>
          </table>
        </div>
      </div>
    </div>
    <hr/>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-12">其他法定管理已经检测传染病：</label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <div class="col-sm-12">
          <textarea  name="otherInfection" rows="3" maxlength="200" class="form-control">${placeInfectionRecord.otherInfection}</textarea>
        </div>
      </div>
    </div>
    <hr/>
    <div class="form-group">
      <div class="col-lg-6">
        <label class="col-sm-4">订正前病名：</label>
        <div class="col-sm-8">
          <input type="text" name="updateBeforeName" value="${placeInfectionRecord.updateBeforeName}" class="form-control">
        </div>
      </div>
      <div class="col-lg-6">
        <label class="col-sm-4">退卡原因：</label>
        <div class="col-sm-8">
          <input type="text" name="returnReason" value="${placeInfectionRecord.returnReason}" class="form-control">
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-6">
        <label class="col-sm-4">报告单位*：</label>
        <div class="col-sm-8">
          <input type="text" name="reportUnit"  data-parsley-required="true" value="${placeInfectionRecord.reportUnit}" class="form-control">
        </div>
      </div>
      <div class="col-lg-6">
        <label class="col-sm-4">联系电话：</label>
        <div class="col-sm-8">
          <input type="text" name="unitPhone" value="${placeInfectionRecord.unitPhone}" class="form-control">
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-6">
        <label class="col-sm-4">报告医生*：</label>
        <div class="col-sm-8">${placeInfectionRecord.doctorName}
          <input type="hidden" name="doctorName"  data-parsley-required="true" value="${placeInfectionRecord.doctorName}" class="form-control">
        </div>
      </div>
      <div class="col-lg-6">
        <label class="col-sm-4">填卡日期*：</label>
        <div class="col-sm-8">
          <input type="text" name="writeDate" data-parsley-required="true"
                 value="<fmt:formatDate value="${placeInfectionRecord.writeDate}" pattern="yyyy-MM-dd" type="date" />" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate"/>
        </div>
      </div>
    </div>
    <hr/>
    <div class="form-group">
      <div class="col-lg-12">
        <label class="col-sm-12">备注：</label>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-12">
        <div class="col-sm-12">
          <textarea  name="remarks" rows="3" maxlength="200" class="form-control">${placeInfectionRecord.remarks}</textarea>
        </div>
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-4">
      </div>
      <div class="col-lg-4">
        <button type="button" id="submit" onclick="checkage()" class="btn btn-primary">保存</button>
        <button onclick="print('${placeInfectionRecord.id}','${clinicMaster.id}','${patMasterIndex.id}')" type="button" class="btn btn-primary">打印</button>
      </div>
    </div>
  </fieldset>
</form>
</div>